using System;
using System.IO;
using System.Collections.Generic;
using System.Text;
using Microsoft.VisualStudio.TestTools.WebTesting;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace HtmlTagInnerTextTests
{
    public sealed class PageManager
    {
        internal TestContext m_context;
        private static PageManager s_instance;

        public static void Initialize(TestContext context)
        {
            s_instance = new PageManager();
            s_instance.m_context = context;
        }

        private PageManager(){}

        public static PageManager Instance
        {
            get 
            { 
                return s_instance; 
            }
        }

        public void LoadPage(string pageName, out HtmlDocument document)
        {
            // Read the load and set it on the first scenario
            StreamReader pageReader = File.OpenText(pageName);
            string contents = pageReader.ReadToEnd();
            pageReader.Close();

            document = new HtmlDocument(new System.Uri("http://localhost"), contents);
        }

        public void LoadPage(string pageName, out string document)
        {
            // Read the load and set it on the first scenario
            StreamReader pageReader = File.OpenText(pageName);
            string contents = pageReader.ReadToEnd();
            pageReader.Close();
            document = contents;
        }

    }
}
